home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
051-060
/
amok56
/
m2maker
/
txt
/
requesterwindow.mod
< prev
next >
Wrap
Text File
|
1993-11-04
|
16KB
|
376 lines
(*---------------------------------------------------------------------------
:Program. m2Maker
:Author. Thomas Stolze
:Address. Goslarsche Str. 32, 3000 Hannover 21, Germany
:Phone. (0)511 / 75 10 77
:Version. V2.0
:Date. 10-Nov-90
:Copyright. Shareware
:Language. Modula-2
:Translator. M2Amiga V3.32d
:Contents. Programming Utility.
:Remark. Supports the M2Amiga System (C) by A+L AG Switzerland
---------------------------------------------------------------------------*)
IMPLEMENTATION MODULE RequesterWindow;
FROM Arts IMPORT Assert;
FROM ExecL IMPORT GetMsg,ReplyMsg,WaitPort;
FROM GraphicsD IMPORT DrawModeSet,jam1,jam2,RastPortPtr;
FROM GraphicsL IMPORT Move,RectFill,SetAPen,SetBPen,SetDrMd,Text;
FROM InitIntuition IMPORT prgPtr;
FROM IntuitionD IMPORT ActivationFlagSet,ActivationFlags,
Gadget,GadgetFlags,GadgetFlagSet,GadgetPtr,
IDCMPFlags,IDCMPFlagSet,IntuiMessagePtr,
IntuiText,IntuiTextPtr,MenuItemFlags,
MenuItemFlagSet,NewWindow,Preferences,
PreferencesPtr,BorderPtr,boolGadget,Border,
ScreenFlags,ScreenFlagSet,strGadget,StringInfo,
WindowFlags,WindowFlagSet,WindowPtr,ScreenPtr,
customScreen;
FROM IntuitionL IMPORT AddGadget,
AddGList,CloseWindow,
OpenWindow,
PrintIText,RefreshGadgets,
UnlockIBase;
FROM IntuitionSupport IMPORT SetBorder,SetBorderKoord,SetGadget,SetInfo,
SetIText,SetWindow;
FROM SYSTEM IMPORT ADDRESS,ADR,CAST,LONGSET,SHIFT,WORD;
CONST help1 = "Functions:";
help2 = "F1 ==> Editor F6 ==> M2Make ^q ==> Quit";
help3 = "F2 ==> Compiler F7 ==> Debug End ^c ==> NewShell";
help4 = "F3 ==> Linker F8 ==> ModuleTOOL ^l ==> Dir";
help5 = "F4 ==> Run F9 ==> Print ^p ==> Project";
help6 = "F5 ==> Make F10 ==> Dir LSHIFT+CTRL+SPACE";
help7 = "P ==> ParentDir O ==> Ok RETURN ==> Select";
help8 = "D ==> Device C ==> Cancel HELP ==> Info";
VAR window : WindowPtr;
PROCEDURE ShowRequest(titleptr : ADDRESS;
x,y,w,h : INTEGER;
textptr : IntuiTextPtr;
gadgptr : GadgetPtr;
screen : ScreenPtr;
cancel : BOOLEAN): BOOLEAN;
CONST action = ActivationFlagSet{gadgImmediate,relVerify};
PROCEDURE Block(rport : RastPortPtr; col,x1,y1,x2,y2 : INTEGER);
BEGIN
SetAPen(rport,col); SetDrMd(rport,jam2); RectFill(rport,x1,y1,x2,y2);
END Block;
VAR nw : NewWindow;
gPtr : GadgetPtr;
ptr : IntuiTextPtr;
msg : IntuiMessagePtr;
response : BOOLEAN;
code : CARDINAL;
class : IDCMPFlagSet;
pos : INTEGER;
bordptr : BorderPtr;
GadgetText : ARRAY [0..1] OF IntuiText;
Gadgets : ARRAY [0..1] OF Gadget;
border : Border;
coor : ARRAY [0..9] OF INTEGER;
BEGIN
ptr:=SetIText(GadgetText[0],ADR(" OK "),2,1,1,2,jam2);
ptr:=SetIText(GadgetText[1],ADR("CANCEL"),2,1,1,2,jam2);
SetWindow(nw,x,y,w,h,0,1,IDCMPFlagSet{gadgetUp,closeWindow,mouseButtons,
vanillaKey},
WindowFlagSet{windowDepth,activate,windowActive,windowClose,
windowRefresh},
titleptr,NIL,NIL,-1,-1,20,40,ScreenFlagSet{wbenchScreen});
IF screen # NIL THEN nw.screen:=screen; nw.type:=customScreen; END;
SetGadget(Gadgets[0],20,-18,50,10,GadgetFlagSet{gRelBottom},
action,boolGadget,ADR(border),ADR(GadgetText[0]),NIL,0);
SetGadget(Gadgets[1],w-70,-18,50,10,GadgetFlagSet{gRelBottom},
action,boolGadget,ADR(border),ADR(GadgetText[1]),NIL,1);
bordptr:=SetBorder(border,-1,-1,2,0,5,jam1,ADR(coor));
SetBorderKoord(coor,Gadgets[0]);
window:=OpenWindow(nw);
Assert(window # NIL,ADR("Couldn't open Requester!"));
Block(window^.rPort,1,4,11,w-5,h-3);
PrintIText(window^.rPort,textptr,0,0);
IF cancel THEN
pos:=AddGadget(window,ADR(Gadgets[1]),-1);
ELSE
Gadgets[0].leftEdge:=w-70;
END;
pos:=AddGadget(window,ADR(Gadgets[0]),-1);
IF (gadgptr # NIL) THEN pos:=AddGList(window,gadgptr,-1,20,NIL) END;
RefreshGadgets(window^.firstGadget,window,NIL);
LOOP
response:=FALSE;
WaitPort(window^.userPort);
msg:=GetMsg(window^.userPort);
class:=msg^.class;
code:=msg^.code;
gPtr:=msg^.iAddress;
ReplyMsg(msg);
IF (closeWindow IN class) THEN
response:=FALSE; EXIT;
ELSIF (gadgetUp IN class) THEN
CASE gPtr^.gadgetID OF
0 : response:=TRUE; EXIT;
| 1 : response:=FALSE; EXIT;
ELSE
END;
ELSIF (vanillaKey IN class) THEN
CASE code OF
13,ORD("y"),ORD("Y"),ORD("j"),ORD("J"),
ORD("o"),ORD("O") : response:=TRUE; EXIT;
| ORD("n"),ORD("N"),ORD("c"),ORD("C"): response:=FALSE; EXIT;
ELSE
END;
END;
END;
CloseWindow(window); window:=NIL;
RETURN response;
END ShowRequest;
PROCEDURE DeleteFileRequester(str : ARRAY OF CHAR): BOOLEAN;
VAR text : ARRAY [0..1] OF IntuiText;
ptr : IntuiTextPtr;
BEGIN
ptr:=SetIText(text[0],ADR("Delete this file ?"),3,1,40,22,jam2);
text[0].nextText:=SetIText(text[1],ADR(str),2,1,40,35,jam2);
RETURN ShowRequest(ADR("Delete File:"),160,20,320,70,ptr,NIL,NIL,TRUE);
END DeleteFileRequester;
PROCEDURE RenameFileRequester(VAR str : ARRAY OF CHAR): BOOLEAN;
VAR gad : Gadget;
text : IntuiText;
tptr : IntuiTextPtr;
border : Border;
bordptr : BorderPtr;
coor : ARRAY [0..9] OF INTEGER;
info : StringInfo;
dummy : ARRAY [0..31] OF CHAR;
BEGIN
bordptr:=SetBorder(border,-1,-1,2,0,5,jam2,ADR(coor));
SetInfo(info,ADR(str),ADR(dummy),0,30,0);
SetGadget(gad,40,35,232,8,GadgetFlagSet{},
ActivationFlagSet{relVerify,gadgImmediate,toggleSelect},
strGadget,bordptr,NIL,ADR(info),2);
SetBorderKoord(coor,gad);
tptr:=SetIText(text,ADR("Enter new Name:"),2,1,40,22,jam2);
RETURN ShowRequest(ADR("Rename File:"),160,20,320,70,tptr,ADR(gad),NIL,TRUE);
END RenameFileRequester;
PROCEDURE OptionRequester;
CONST actions = ActivationFlagSet{relVerify,gadgImmediate,toggleSelect};
gadgetFlags = GadgetFlagSet{};
VAR dummy : ARRAY [0..12],[0..150] OF CHAR;
Text : ARRAY [0..12] OF IntuiText;
GadgetArray : ARRAY [0..12] OF Gadget;
Infos : ARRAY [0..12] OF StringInfo;
coor : ARRAY [0..0],[0..12] OF INTEGER;
border : ARRAY [0..0] OF Border;
ptr : IntuiTextPtr;
bptr : BorderPtr;
bool : BOOLEAN;
i : INTEGER;
BEGIN
ptr:=SetIText(Text[0],ADR("M2Emacs {+-bcdilr -gpt}") ,2,0,15, 17,jam1);
ptr:=SetIText(Text[1],ADR("M2C {+-cdefhilnpqrsvwyz}") ,2,0,15, 29,jam1);
ptr:=SetIText(Text[2],ADR("M2L {+-acdimqrx -lst}") ,2,0,15, 41,jam1);
ptr:=SetIText(Text[3],ADR("M2Project {+-bimorst}") ,2,0,15, 53,jam1);
ptr:=SetIText(Text[4],ADR("M2Make {+-dfilnpqw -cost}") ,2,0,15, 65,jam1);
ptr:=SetIText(Text[5],ADR("M2Debugger {}") ,2,0,15, 77,jam1);
ptr:=SetIText(Text[6],ADR("KillM2Debug {}") ,2,0,15, 89,jam1);
ptr:=SetIText(Text[7],ADR("M2Pool {-g}") ,2,0,15,101,jam1);
ptr:=SetIText(Text[12],ADR("M2Ohm") ,2,0,15,113,jam1);
ptr:=SetIText(Text[8],ADR("Print Utility") ,0,0,15,125,jam1);
ptr:=SetIText(Text[9],ADR("FastLister") ,0,0,15,137,jam1);
ptr:=SetIText(Text[10],ADR("User Track I") ,0,0,15,149,jam1);
ptr:=SetIText(Text[11],ADR("User Track II") ,0,0,15,161,jam1);
FOR i:=1 TO 12 DO Text[i-1].nextText:=ADR(Text[i]) END;
SetGadget(GadgetArray[0],236,17,344,8,gadgetFlags,
actions,strGadget,ADR(border[0]),NIL,ADR(Infos[0]),2);
SetGadget(GadgetArray[1],236,29,344,8,gadgetFlags,
actions,strGadget,ADR(border[0]),NIL,ADR(Infos[1]),3);
SetGadget(GadgetArray[2],236,41,344,8,gadgetFlags,
actions,strGadget,ADR(border[0]),NIL,ADR(Infos[2]),4);
SetGadget(GadgetArray[3],236,53,344,8,gadgetFlags,
actions,strGadget,ADR(border[0]),NIL,ADR(Infos[3]),5);
SetGadget(GadgetArray[4],236,77,344,8,gadgetFlags,
actions,strGadget,ADR(border[0]),NIL,ADR(Infos[4]),6);
SetGadget(GadgetArray[5],236,89,344,8,gadgetFlags,
actions,strGadget,ADR(border[0]),NIL,ADR(Infos[5]),7);
SetGadget(GadgetArray[6],236,101,344,8,gadgetFlags,
actions,strGadget,ADR(border[0]),NIL,ADR(Infos[6]),8);
SetGadget(GadgetArray[7],236,125,344,8,gadgetFlags,
actions,strGadget,ADR(border[0]),NIL,ADR(Infos[7]),9);
SetGadget(GadgetArray[8],236,137,344,8,gadgetFlags,
actions,strGadget,ADR(border[0]),NIL,ADR(Infos[8]),10);
SetGadget(GadgetArray[9],236, 65,344,8,gadgetFlags,
actions,strGadget,ADR(border[0]),NIL,ADR(Infos[9]),11);
SetGadget(GadgetArray[10],236,149,344,8,gadgetFlags,
actions,strGadget,ADR(border[0]),NIL,ADR(Infos[10]),12);
SetGadget(GadgetArray[11],236,161,344,8,gadgetFlags,
actions,strGadget,ADR(border[0]),NIL,ADR(Infos[11]),13);
SetGadget(GadgetArray[12],236,113,344,8,gadgetFlags,
actions,strGadget,ADR(border[0]),NIL,ADR(Infos[12]),14);
FOR i:=1 TO 12 DO GadgetArray[i-1].nextGadget:=ADR(GadgetArray[i]) END;
SetInfo(Infos[0],ADR(prgPtr^.BufferString[ 4]),ADR(dummy[0]),0,149,0);
SetInfo(Infos[1],ADR(prgPtr^.BufferString[ 5]),ADR(dummy[1]),0,149,0);
SetInfo(Infos[2],ADR(prgPtr^.BufferString[ 6]),ADR(dummy[2]),0,149,0);
SetInfo(Infos[3],ADR(prgPtr^.BufferString[ 7]),ADR(dummy[3]),0,149,0);
SetInfo(Infos[4],ADR(prgPtr^.BufferString[ 8]),ADR(dummy[4]),0,149,0);
SetInfo(Infos[5],ADR(prgPtr^.BufferString[ 9]),ADR(dummy[5]),0,149,0);
SetInfo(Infos[6],ADR(prgPtr^.BufferString[10]),ADR(dummy[6]),0,149,0);
SetInfo(Infos[7],ADR(prgPtr^.BufferString[11]),ADR(dummy[7]),0,149,0);
SetInfo(Infos[8],ADR(prgPtr^.BufferString[12]),ADR(dummy[8]),0,149,0);
SetInfo(Infos[9],ADR(prgPtr^.BufferString[13]),ADR(dummy[9]),0,149,0);
SetInfo(Infos[10],ADR(prgPtr^.BufferString[14]),ADR(dummy[10]),0,149,0);
SetInfo(Infos[11],ADR(prgPtr^.BufferString[15]),ADR(dummy[11]),0,149,0);
SetInfo(Infos[12],ADR(prgPtr^.BufferString[16]),ADR(dummy[12]),0,149,0);
SetBorderKoord(coor[0],GadgetArray[0]);
bptr:=SetBorder(border[0],-1,-1,3,0,5,jam1,ADR(coor[0]));
bool:=ShowRequest(ADR("m2Maker Options:"),20,6,600,194,ADR(Text[0]),
ADR(GadgetArray[0]),NIL,FALSE);
END OptionRequester;
PROCEDURE InfoRequester;
VAR ptr : IntuiTextPtr;
Text : ARRAY [0..7] OF IntuiText;
bool : BOOLEAN;
BEGIN
ptr:=SetIText(Text[0],ADR("The "),2,0,25,20,jam1);
Text[0].nextText:=SetIText(Text[1],
ADR("m2Maker"),0,0,57,20,jam1);
Text[1].nextText:=SetIText(Text[2],
ADR('is a "Shareware-Program".'),2,0,129,20,jam1);
Text[2].nextText:=SetIText(Text[3],
ADR("If you like my program send me please"),2,0,25,32,jam1);
Text[3].nextText:=SetIText(Text[4],
ADR("DM 20,-, $10 (or more ...) to "),2,0,25,44,jam1);
Text[4].nextText:=SetIText(Text[5],
ADR(" Thomas Stolze , Goslarsche Str. 32"),0,0,25,56,jam1);
Text[5].nextText:=SetIText(Text[6],
ADR(" 3000 Hannover 21 , Germany"),0,0,25,66,jam1);
Text[6].nextText:=SetIText(Text[7],
ADR("Copyright by Thomas Stolze © Feb. 1991"),2,0,25,78,jam1);
bool:=ShowRequest(ADR("m2Maker Info:"),80,20,480,102,ptr,NIL,NIL,FALSE);
END InfoRequester;
PROCEDURE LoadProjectRequester(VAR str : ARRAY OF CHAR): BOOLEAN;
VAR tptr : IntuiTextPtr;
text : ARRAY [0..1] OF IntuiText;
gad : Gadget;
border : Border;
bordptr : BorderPtr;
coor : ARRAY [0..9] OF INTEGER;
info : StringInfo;
dummy : ARRAY [0..31] OF CHAR;
BEGIN
bordptr:=SetBorder(border,-1,-1,2,0,5,jam2,ADR(coor));
SetInfo(info,ADR(str),ADR(dummy),0,30,0);
SetGadget(gad,90,40,232,8,GadgetFlagSet{},
ActivationFlagSet{relVerify,gadgImmediate,toggleSelect},
strGadget,bordptr,NIL,ADR(info),2);
SetBorderKoord(coor,gad);
tptr:=SetIText(text[0],ADR("Please enter Directory:"),2,1,20,22,jam2);
text[0].nextText:=SetIText(text[1],ADR("Project:"),0,1,20,40,jam2);
RETURN ShowRequest(ADR("Load Project:"),150,20,340,82,tptr,ADR(gad),NIL,TRUE);
END LoadProjectRequester;
PROCEDURE DeleteProjectRequester(str : ARRAY OF CHAR): BOOLEAN;
VAR text : ARRAY [0..1] OF IntuiText;
ptr : IntuiTextPtr;
BEGIN
ptr:=SetIText(text[0],ADR("Do you want to delete this Project ?"),
3,1,17,22,jam2);
text[0].nextText:=SetIText(text[1],ADR(str),2,1,40,39,jam2);
RETURN ShowRequest(ADR("Delete Project:"),160,20,320,82,ptr,NIL,NIL,TRUE);
END DeleteProjectRequester;
PROCEDURE HelpRequester;
VAR ptr : IntuiTextPtr;
Text : ARRAY [0..7] OF IntuiText;
bool : BOOLEAN;
BEGIN
ptr:=SetIText(Text[0],ADR(help1),2,0,25,20,jam1);
Text[0].nextText:=SetIText(Text[1],ADR(help2),0,0,25,32,jam1);
Text[1].nextText:=SetIText(Text[2],ADR(help3),0,0,25,44,jam1);
Text[2].nextText:=SetIText(Text[3],ADR(help4),0,0,25,56,jam1);
Text[3].nextText:=SetIText(Text[4],ADR(help5),0,0,25,68,jam1);
Text[4].nextText:=SetIText(Text[5],ADR(help6),0,0,25,80,jam1);
Text[5].nextText:=SetIText(Text[6],ADR(help7),2,0,25,104,jam1);
Text[6].nextText:=SetIText(Text[7],ADR(help8),2,0,25,116,jam1);
bool:=ShowRequest(ADR("HELP Info:"),80,20,480,147,ptr,NIL,NIL,FALSE);
END HelpRequester;
PROCEDURE M2EmacsRequester(txt : ADDRESS; screen : ScreenPtr);
VAR ptr : IntuiTextPtr;
Text : ARRAY [0..2] OF IntuiText;
bool : BOOLEAN;
BEGIN
ptr:=SetIText(Text[0],ADR("Error in file:"),2,0,25,20,jam1);
Text[0].nextText:=SetIText(Text[1],txt,3,0,25,32,jam1);
Text[1].nextText:=SetIText(Text[2],ADR("Change your current textbuffer !"),
2,0,25,44,jam1);
bool:=ShowRequest(ADR("M2c to M2Emacs:"),160,20,320,82,ptr,NIL,screen,FALSE);
END M2EmacsRequester;
PROCEDURE M2LErrorRequester(txt : ADDRESS; screen : ScreenPtr);
VAR ptr : IntuiTextPtr;
Text : ARRAY [0..2] OF IntuiText;
bool : BOOLEAN;
BEGIN
ptr:=SetIText(Text[0],ADR("Key problems or file not compiled:"),2,0,25,20,jam1);
Text[0].nextText:=SetIText(Text[1],txt,3,0,25,32,jam1);
Text[1].nextText:=SetIText(Text[2],ADR("Start M2Make to handle problems !"),
2,0,25,44,jam1);
bool:=ShowRequest(ADR("M2L to M2Emacs:"),160,20,320,82,ptr,NIL,screen,FALSE);
END M2LErrorRequester;
PROCEDURE TouchRequester(): BOOLEAN;
VAR ptr : IntuiTextPtr;
Text : ARRAY [0..2] OF IntuiText;
BEGIN
ptr:=SetIText(Text[0],ADR("All files will be touched !"),2,0,25,20,jam1);
Text[0].nextText:=SetIText(Text[1],ADR("M2Make will compile all files new!"),
3,0,25,32,jam1);
Text[1].nextText:=SetIText(Text[2],ADR("No datas will be lost. Don't worry!"),
2,0,25,44,jam1);
RETURN ShowRequest(ADR("Touch Requester:"),160,20,320,82,ptr,NIL,NIL,TRUE);
END TouchRequester;
BEGIN
CLOSE
IF (window # NIL) THEN CloseWindow(window); window:=NIL; END;
END RequesterWindow.